Repository navigation
feat: pharn verify-archive checks a local pharn-oss archive as an install would (CORE-387) - #449
Conversation
… other entry (CORE-386) pharn-oss v7.25.3-v7.25.5 commit seven symlinks under .claude/skills/, outside pharn-install.json, and the extractor refused any non-file entry anywhere in the archive, so every init/add/update/status failed on every channel. The extractor now selects, then judges: two streamed passes over the archive write only the files the CLI reads itself (CLONE_READ_FILES) and then, once the manifest has validated, only the paths it lists. Every other entry is skipped and never written, whatever its type or name. A listed path keeps every rule (regular file, strict UTF-8, no control/format char, no absolute/../\/:, one root, no duplicate) and a pax/GNU-modified entry at a listed path is refused; verifyUpstreamManifest still fails a listed file that is missing or altered. The tar is streamed through createGunzip, so the 128 MB cap now bounds bytes written; headers (200k) and decompressed bytes (1 GiB) bound the walk. extractPharnArchive takes a buffer, for a later local verify-archive mode. Docs (CLAUDE.md, architecture, contributing, SECURITY, THREAT-MODEL via the user's patch) and CHANGELOG [Unreleased] updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (CORE-386) Bump to 0.21.6 (epic-coordinated) and move the CORE-386 entry into the [0.21.6] CHANGELOG section; v0.21.5 joins KNOWN_TAGS. pharn-ci TI02 read the restructured tar-extract tests as removals. The tests keep their base names now (the same behaviour, re-expressed against the selection), with the old merged g-header and BOM cases split back out. The init test is back to its base text: the new marker message still contains it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pharn-ci TI02 still read eight base tests as removed (computed it.each names
match by body). They are back with their base bodies: a test-level LIMITS
selects every path they use (latin1 keys), so each entry is judged by the full
rules exactly as before. A rootless entry named like a selected path is now
refused ("no path below the archive root") rather than skipped, which restores
"rejects a file with no component to strip". CLAUDE.md no longer names
pharn-install.json as a repo path (pharn-ci SETUP_STALE_SI02).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CORE-386)
The refusal of a listed file after a modifier header now names that header's
type through describeTypeflag ("unsupported type 'x' (a pax extended
header, ...)"), so the base pax test keeps its expected value. The base test
"bounds the bytes written by the decompressed size" keeps its name, now over
the streamed decompressed cap (maxScannedBytes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tall would (CORE-387) A new read-only command for pharn-oss CI: it runs the install path's own extractPharnArchive (both passes, manifest validation, every listed sha256) over a local .tar.gz, plus the capability-index build and a MIN_CLI validity check, with no network, no project and no lock, in one private temp dir that verifyLocalArchive (repo.ts) always removes. --expect-version X.Y.Z holds SKILLS_VERSION to a version through assertSkillsVersion, the helper the release check in fetchAt now shares. The input is read bounded (regular file, 32 MiB, no FIFO hang). The archive needs one top-level directory (git archive --prefix=pharn-oss/); a rootless one gets a message naming it. Version 0.22.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-only' into feat/core-387-verify-archive # Conflicts: # CHANGELOG.md # package-lock.json # package.json
…actor's rootless refusal (CORE-387) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…archive # Conflicts: # CHANGELOG.md # package-lock.json # package.json # src/lib/repo.ts # tests/release-consistency.test.ts # tests/repo.test.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
🛡️ pharn-ci ·
|
| Verdict | Diff coverage | Test integrity | Agent setup |
|---|---|---|---|
| 100% (threshold 80%) | 33 files |
🧪 Diff coverage
▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ 100%
100% of changed lines covered (61/61, threshold 80%)
Changed files (5)
| File | Coverage | Covered | Uncovered lines |
|---|---|---|---|
src/commands/verify-archive.ts |
100% | 40/40 | |
src/index.ts |
100% | 3/3 | |
src/lib/cli-args.ts |
100% | 7/7 | |
src/lib/repo.ts |
100% | 9/9 | |
src/lib/skills-version.ts |
100% | 2/2 |
🔍 Test integrity
⚠️ TI12tests/index.test.ts:43— vi.mock("../src/commands/verify-archive.js") replaces src/commands/verify-archive.ts, a source file this change also edits, so the test may not run the code under review.- Hint: Ask a reviewer to confirm that mocking the changed module still tests its real behaviour.
Tests changed: +32 −0 ~0
| Test file | Added | Removed | Modified | Renamed |
|---|---|---|---|---|
tests/cli-args.test.ts |
3 | 0 | 0 | 0 |
tests/commands/verify-archive.test.ts |
22 | 0 | 0 | 0 |
tests/dist-smoke.test.ts |
1 | 0 | 0 | 0 |
tests/repo.test.ts |
3 | 0 | 0 | 0 |
tests/skills-version.test.ts |
3 | 0 | 0 | 0 |
🤖 Agent setup (33 files)
Agent setup: 33 files · amp, claude-code, codex, copilot, cursor, jules, opencode, zed
Agent setup files (33)
| Path | Kind |
|---|---|
.claude/commands/pharn-dev-build.md |
claude-command |
.claude/commands/pharn-dev-eval.md |
claude-command |
.claude/commands/pharn-dev-grill.md |
claude-command |
.claude/commands/pharn-dev-memory-promote.md |
claude-command |
.claude/commands/pharn-dev-plan.md |
claude-command |
.claude/commands/pharn-dev-regress.md |
claude-command |
.claude/commands/pharn-dev-review.md |
claude-command |
.claude/commands/pharn-dev-ship.md |
claude-command |
.claude/commands/pharn-dev-verify.md |
claude-command |
.claude/hooks/enforce-writes-scope.cjs |
claude-hook |
.claude/hooks/enforce-writes-scope.test.cjs |
claude-hook |
.claude/hooks/git-worktree-fixture.cjs |
claude-hook |
.claude/hooks/protect-trusted-paths.cjs |
claude-hook |
.claude/hooks/protect-trusted-paths.test.cjs |
claude-hook |
.claude/hooks/session-root.cjs |
claude-hook |
.claude/hooks/session-root.test.cjs |
claude-hook |
.claude/hooks/set-writes-scope.cjs |
claude-hook |
.claude/hooks/set-writes-scope.test.cjs |
claude-hook |
.claude/settings.json |
claude-settings |
.claude/skills/phargus-diagnose |
claude-skill |
.claude/skills/phargus-memory |
claude-skill |
.claude/skills/phargus-rules |
claude-skill |
.claude/skills/phargus-setup |
claude-skill |
.claude/skills/phargus-verify |
claude-skill |
.claude/skills/pharn-ci-cover |
claude-skill |
.claude/skills/pharn-ci-explain |
claude-skill |
.claude/skills/pharn-ci-fix |
claude-skill |
.claude/skills/pharn-ci-install |
claude-skill |
.claude/skills/pharn-ci-policy |
claude-skill |
.claude/skills/pharn-cli |
claude-skill |
.claude/skills/security-audit |
claude-skill |
AGENTS.md |
agents-md |
CLAUDE.md |
claude-md |
pharn-ci 0.12.0 · report schema v2 · coverage format lcov
…sal failure (CORE-387) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On the pharn-ci warnings:
|
…archive # Conflicts: # CHANGELOG.md # docs/troubleshooting.md # package-lock.json # package.json # tests/repo.test.ts # tests/support/tar-fixture.ts
Refs CORE-380. Builds on CORE-386 (#448, merged and released as 0.21.6), which made the extractor take a buffer.
What
This adds
pharn verify-archive <file> [--expect-version X.Y.Z], which checks a local pharn-oss.tar.gzthe way an install checks a download. pharn-oss CI can use it to find out that a commit installs before it tags that commit.extractPharnArchive: both passes, thepharn-install.jsonparser, and every listed sha256. It also runs the install's two pure reads of the tree:manifestCapabilityIndex). Unknownappliestokens get the same warning an install prints, and the check still passes.MIN_CLI, for validity only. A present but unusableMIN_CLIfails the check, which is stricter than install on purpose. No version comparison is made.--expect-versionholdsSKILLS_VERSIONto a version throughassertSkillsVersion, a new helper inskills-version.ts. The release check infetchAtnow calls the same helper, and its message is byte-identical.verifyLocalArchiveinrepo.tscreates one privatepharn-verify-*temp dir, registers it with the clone's exit/fatal-signal backstop, and removes it in afinally.readBoundedFile(unchanged): regular file only, capped atMAX_ARCHIVE_BYTES(32 MiB, the download cap), with no FIFO hang. The path is escaped wherever it is printed.CliError:error;failurewithArchive <name> refused: <rule + entry>, plus the PHARN_DEBUG hint, or the original error underPHARN_DEBUG=1.git archive --prefix=pharn-oss/. A plaingit archivefails with the extractor's refusal plus the fix. The install path's rules are unchanged.--json, decided at GATE 1: CI gates on the exit code.For pharn-oss CI (CORE-384, copy this)
Build the archive from the same commit that will be tagged, and pin the
pharnversion.PR / push job, checked against the commit's own SKILLS_VERSION:
Release job, before the tag is pushed (
TAG=v7.25.6, for example):npx … @0.22.0works only once this PR is merged and 0.22.0 is published. Node 24.2.0 or newer is required.Live Done-when (built bundle,
node dist/index.js)$Sis a scratch directory. The pharn-oss repo was used read-only (git -C … archive).The ticket's Done-when names "a git archive --format=tar.gz HEAD". It passes with
--prefix=pharn-oss/added, which is the documented form, and case (d) shows why that flag is needed.Tests
tests/commands/verify-archive.test.ts(new, 21 cases, through the harness):--expect-versionmismatch, a malformedMIN_CLI, a non-gzip file;fetchis never called, and the temp dir is gone on a pass and on a fail.cli-args(parse and refusals, help),index(dispatch),repo(verifyLocalArchivecleanup),skills-version(assertSkillsVersion), anddist-smoke(the bundle passes a fixture and refuses a missing file).tests/support/tar-fixture.ts: an optionaloptsargument (extra or replaced raw entries, rootless). Existing callers get identical bytes.tests/release-consistency.test.ts:v0.21.6joins KNOWN_TAGS. That tag exists now, and[0.22.0]compares from it.Local gates: test, validate, lint, format:check, lint:md, typecheck and build are all 0. Coverage 98.59 / 95.77 / 99.08 / 99.07. Regress against
f9fa96b0found no regressions. Records are in.dev/features/core-387-verify-archive/.Version 0.22.0 (minor: a new command), with a CHANGELOG
[0.22.0]section above[0.21.6]. This will conflict with #447 (0.21.7) on package.json, the lockfile, CHANGELOG and release-consistency, whichever merges first.🤖 Generated with Claude Code